Xis a general purpose command line editor with the addition of predictive text
Xgeneration. It interfaces with a standard shell and allows simple editing
Xof input lines. It will also predict new input lines based on previous
Xinput.
X
X.SH PREDICTIVE TEXT GENERATION
X.I "The Reactive Keyboard"
X(\fIrk\fP) accelerates typewritten communication with a
Xcomputer system by predicting what the user is going to type next. To
Xenable it to make predictions, a model of previously-entered
Xtext is created and maintained adaptively. (The modeling technique was
Xdeveloped for use in text compression, and in fact forms the basis of
Xone of the most effective existing compression methods.) This generally
Xcontains a large number of recurring selection element sequences
X(n-grams), with associated occurrence frequencies. The current
Xcontext, recent selections, is used to look up likely continuations.
X
XThe basic idea is to order context-conditioned candidate strings, which
Xare predicted by the model, according to popularity and display them
Xfor selection. Each prediction starts with a different \s-2ASCII\s+2
Xcharacter, so that the entire character set can always be accessed.
XDisplayed options are actually concatenations of several predicted
Xcharacters. With the standard keyboard interface the user can cycle
Xthrough these predictions and accept all or part of any one. Accepted
Xpredictions appear to the computer system as though the user had typed
Xthem himself.
X
XObviously predictions are not always correct, but they are correct
Xoften enough to form the basis of a useful communication device. Since
Xthey are created adaptively, based on what the user has already typed
Xin this session or in previous ones, the system conforms to whatever
Xkind of text is being entered. Prediction accuracy improves continually
Xas user history accumulates.
X
XPresent implementations have proved most useful in enhancing the
Xcommand interface to the \s-2UNIX\s+2 operating system by predicting commands,
Xarguments, and filenames; and for the entry of free text. Although
Xdesigned as a general purpose computer interface, the Reactive Keyboard
Xalso has great potential to enhance the ease and rate of communication
Xfor physically limited people.
X
X.SH TECHNICAL DESCRIPTION
X
X.I "The Reactive Keyboard"
Xopens a shell on a pseudo terminal (pty). Any input typed by the
Xuser is sent to the standard input of the shell. Any output from the
Xshell is simply sent to the screen. The advantage of this setup is
Xthat programs do not need to do anything special to work with \fIrk\fP.
X
X.I "The Reactive Keyboard"
Xautomatically switches off when a program is competing for control of the
Xpty. Programs like screen editors for example will cause \fIrk\fP to shut off.
XOther programs can be run with \fIrk\fP turned off with
Xthe ``run-tty-program'' function.
X
X.SH OPTIONS
X.IP "\-b <buffers>"
XThe number of buffers used by \fIrk\fP to save previous commands used by
X.I "previous_line."
XDefault: 60.
X.PP
X.IP "\-e <eol length>"
XThe maximum length of predictions at the end of the line. Default: 40.
X.PP
X.IP "\-f <count>"
XThe maximum frequency count for any given context. Default: 128.
X.PP
X.IP "\-i <inline length>"
XThe maximum length of predictions in the middle of the line. Default: 8.
X.PP
X.IP "\-k <keys file>"
XThe file to read key bindings from. Default:\fI$HOME/.rk.keys.\FP
X.PP
X.IP "\-n <number of nodes>"
XThe amount of memory to allocate initially to speed up creation of nodes.
XAfter this memory is used up, more will be allocated, but this will be slower.
XDefault: 64*1024 nodes.
X.PP
X.IP "\-o <model order>"
XThis argument controls how deep a tree will be built by \fIrk\fP in order to make predictions. As
X.I k
Xincreases, the accuracy of predictions increases, but the speed decreases.
XDefault: 8.
X.PP
X.IP "\-p <prime file>"
XThe file used to prime the
X.I "Reactive Keyboard."
XDefault:
X.I "$HOME/.rk.log_file."
X.PP
X.IP "\-s <startup amount>"
XThe maximum number of characters to be read from the prime file at startup.
XDefault: 16*1024.
X.PP
X.IP "\-z <zero freq>"
XThe zero frequency file name. See Zero Frequency below. This argument defaults to
X.I "$HOME/.rk.zero_freq"
Xif it is not present.
X.PP
X.IP "\-A"
XWhen you accept a predicted word,
X.I "rk"
Xusually accepts all characters up to a space. If the \-A option is present,
Xthe space is also accepted.
X.PP
X.IP "\-E"
X.I "rk"
Xnormally never displays predictions in the middle of a line. If the \-E
Xoption is present
X.I "rk"
Xwill display predictions no matter where the cursor is.
X.PP
X.IP "\-L"
XBy default, predictions made at the end of a line are longer than those made
Xin the middle of a line. The \-L option disables this feature.
X.PP
X.IP "\-N"
XNormally, predictions stop at the end of a line. The \-N option causes
X.I "rk"
Xto continue making predictions past the end of the line, allowing several
Xcommands to be predicted at once.
X.PP
X.IP "\-P"
XThe \-P option disables display of predictions. If the \-P option is present,
Xthe predictions are still made, and
X.I "rk"
Xstill reads all input, but the predictions are not displayed.
X.PP
X.IP "\-S"
XNormally, when
X.I "rk"
Xpredicts a line, it shows the whole line up to and including the return (^J) at the
Xend. If the \-S option is present, the return at the end of the line is not
Xdisplayed.
X.IP "\-g"
XNormally,
X.I "rk"
Xopens a login shell. This means the users .login will be run and it is
Xpossible to quit
X.I "rk"
Xby typing "logout". The \-g
Xoption causes
X.I "rk"
Xto open a normal shell and not run the users .login.
X.PP
X.IP "\-h"
XThe \-h option causes a short description of the command line arguments to be
Xprinted.
X.PP
X.IP "\-l"
XThe \-l option turns on lisp mode, and allows ()'s to be matched.
X.PP
X.IP "\-m"
XIf the \-m option is present, the normal startup messages will be skipped.
X.PP
X.IP "\-v"
XThe \-v option prints the current version of the
X.I "Reactive Keyboard."
X.PP
X
X.SH "EXAMPLES"
X
X.I rk \-gmP
XSilently open a shell with the line editor enabled, but the predictions turned
Xoff.
X
X.I rk \-h
XJust print help for the command line arguments.
X
X.I rk \-o5
XRun the predictions, but make the order of the model only 5 instead of 8.
X
X.I rk \-z cfreq \-p cprimefile
XLoads the file cfreq into the zero frequency table and primes the prediction
Xmechanism with the file cprimefile. Using these two arguments, it is
Xpossible to set up different environments for prediction. In the above
Xexample, cfreq could have been created using a large C source file as input
Xand cprimefile could be another large C source file. With these inputs, the
Xinput of C programs will be simplified as
X.I "rk"
Xwill predict common variable
Xnames and keywords.
X
X
X.SH "BINDABLE EDITING COMMANDS"
X
X.SS "Selection Control"
X.IP "accept_forward_char"
XAccept the next predicted character.
X.PP
X.IP "accept_forward_word"
XAccept the next predicted word.
X.PP
X.IP "accept_to_end_of_line"
XAccept the whole predicted line.
X.PP
X.IP "next_pred"
XShow next alternative prediction.
X.PP
X.IP "previous_pred"
XShow the previous alternative prediction.
X
X.SS "Display Control"
X.IP "clear_display"
XClear the screen and redraw the current edit line.
X.PP
X.IP "toggle_add_space_mode"
XWhen you accept a predicted word,
X.I "rk"
Xusually accepts all characters up to a space. If add_space_mode is true,
Xthe space is also accepted.
X.PP
X.IP "toggle_eol_longer_mode"
XBy default, predictions made at the end of a line are longer than those made
Xin the middle of a line. If eol_longer_mode is turned off this feature is
Xdisabled.
X.PP
X.IP "toggle_eol_only_mode"
X.I "rk"
Xnormally never displays predictions in the middle of a line. If
Xeol_only_mode is true
X.I "rk"
Xwill display predictions no matter where the cursor is.
X.PP
X.IP "toggle_nl_truncate_mode"
XNormally, predictions stop at the end of a line. If nl_truncate_mode is
Xfalse,
X.I "rk"
Xcontinues making predictions past the end of the line, allowing several
Xcommands to be predicted at once.
X.PP
X.IP "toggle_pred_mode"
XIF pred_mode is false, display of predictions is disabled.
XThe predictions are still made, and
X.I "rk"
Xstill reads all input, but the predictions are not displayed.
X.PP
X.IP "toggle_show_eol_mode"
XNormally, when
X.I "rk"
Xpredicts a line, it shows the whole line up to and including the return (^J) at the
Xend. If the show_eol_mode is false, the return at the end of the line is not
Xdisplayed.
X.SS "Model Control"
X
X.IP "prime_from_file"
XPrime the predictions from a file.
X.PP
X.IP "show_free_nodes"
XShow memory usage information for debugging.
X
X.SS "Error Control (editing)"
X.IP "backspace_char"
XBackspace a single character.
X.PP
X.IP "backspace_word"
XBackspace a single word.
X.PP
X.IP "backward_char"
XGo backwards a single character.
X.PP
X.IP "backward_paren"
XGo backwards to a matching parenthesis ``(''.
X.PP
X.IP "backward_word"
XGo backwards a single word.
X.PP
X.IP "beginning_of_line"
XMove to the beginning of the line.
X.PP
X.IP "capitalize_word"
XCapitalize this word.
X.PP
X.IP "close_paren"
XClose and show matching parenthesis. This only has a visible effect if
Xlisp_mode is on.
X.PP
X.IP "dash_to_ul_word"
XConvert \-'s to _'s in this word.
X.PP
X.IP "delete_char"
XDelete a single character.
X.PP
X.IP "delete_region_to_killbuffer"
XDelete marked region to killbuffer.
X.PP
X.IP "delete_word"
XDelete a single word.
X.PP
X.IP "discard_current_edit_line"
XDelete this line and forget it.
X.PP
X.IP "discard_rest_of_line"
XDelete rest of line to killbuffer.
X.PP
X.IP "end_of_line"
XMove to the end of the line.
X.PP
X.IP "file_completion"
XExpand pathname from the current prefix.
X.PP
X.IP "finish_editing_line"
XEnter this line.
X.PP
X.IP "forward_char"
XGo forward a single character.
X.PP
X.IP "forward_paren"
XMove to matching close parenthesis ``)''.
X.PP
X.IP "forward_word"
XGo forward a single word.
X.PP
X.IP "increment_universal_argument"
XDo the next command 4^(presses) times. For example, assume
Xincrement_universal_argument is bound to ^U and forward_char is bound top ^F.
XIf the user types ^U^U^F the cursor will move forward 4^2 or 16 spaces.
X.PP
X.IP "insert_interrupt_char"
XSend an interrupt character. This usually kills the current process.
X.PP
X.IP "insert_quit_char"
XSend a quit character. This usually kills the current process and causes a
Xcore image to be dumped.
X.PP
X.IP "insert_start_char"
XSend a start character. This usually continues output stopped by
Xinsert_stop_char.
X.PP
X.IP "insert_stop_char"
XSend a stop character. This usually pauses output from a program.
X.PP
X.IP "insert_suspend_char"
XSend a suspend character. This usually stops a process.
X.PP
X.IP "lowercase_word"
XLowercase this word.
X.PP
X.IP "next_line"
XShow the next line buffer.
X.PP
X.IP "open_paren"
XOpen and show matching parenthesis. This only has a visible effect if
Xlisp_mode is on.
X.PP
X.IP "previous_line"
XShow the previous line buffer.
X.PP
X.IP "quote_char"
XLiterally insert the next character.
X.PP
X.IP "self_insert"
XLiterally insert the current character.
X.PP
X.IP "set_mark"
XSet mark at the current cursor position.
X.PP
X.IP "show_mark"
XShow the position of the current mark.
X.PP
X.IP "toggle_lisp_mode"
XWhen lisp mode is turned on,
X.I rk
Xwill automatically match parenthesis.
X.PP
X.IP "twiddle_chars"
XExchange previous two characters.
X.PP
X.IP "ul_to_dash_word"
XConvert _'s to \-'s in this word.
X.PP
X.IP "uppercase_word"
XUppercase this word.
X.PP
X.IP "yank_from_kill_buffer"
XInsert text stored in killbuffer.
X.PP
X
X.SS "Panic Control"
X.IP "describe_arguments"
XShow the current command line arguments.
X.PP
X.IP "describe_bindings"
XShow the current key bindings. This is usually bound to Esc-?.
X.PP
X.IP "show_version"
XShow the current version number and date.
X.PP
X.SS "Other"
X.IP "BOGUS, bogus or null"
XNull routine, beeps terminal bell. If you want to unbind a key, bind
Xit to this command.
X.PP
X.IP "command_completion"
XExpand a command using $PATH.
X.PP
X.IP "run_mesg"
XRun the mesg command.
X.PP
X.IP "run_ruptime"
XRun the ruptime command.
X.PP
X.IP "run_talk"
XRun the talk command.
X.PP
X.IP "run_tty_program"
XRun a program with \fIrk\fP turned off.
X.PP
X.IP "run_write"
XRun the write command.
X.PP
X
X
X.SH CHANGING KEY BINDINGS
XOn startup,
X.I rk
Xlooks for the file \fI$HOME/.rk.keys\fP or a file specified by the \-k option.
XIf it exists,
X.I rk
Xreads new key bindings from it. Bindings consist of a function name
Xfollowed by a key to bind to in double quotes ("). Control characters
Xmay be imbedded in this string by the ^ character, so ^A is Control-A.
XThe \\ character works the same way as the \\ character in termcap entries:
X.TS
Xcenter,tab (@);
Xl.
X\\\\E is Escape
X\\\\n is newline
X\\\\r is carrige return
X\\\\t is tab
X\\\\\\\\ is a single \\\\
X\\\\^ is a single ^
X.TE
X
XIf you leave off the quotes, the corresponding entry is read from the termcap file. See the manual entry for termcap for a list of these capabilities.
X
XFor example, a file like this:
X.TS
Xcenter,tab (@);
Xl.
Xaccept_forward_word "^N"
Xdescribe_bindings "^[?"
Xtoggle_lisp_mode k1
X.TE
X
Xwould bind Control-N to accept_forward_word, Escape-? to describe_bindings
Xand Function key F1 to toggle_lisp_mode
X
X.SH DEFAULT BINDINGS
X
XThe default bindings are as follows (Note ^[p means Esc-p):
X.TS
Xcenter,tab (@);
Xl l.
Xaccept_forward_char@^Q
Xaccept_forward_word@^W
Xaccept_to_end_of_line@^S
Xbackspace_char@^H
Xbackspace_word@^G or ^[h
Xbackward_char@^B or kl
Xbackward_paren@^[(
Xbackward_word@^[b
Xbeginning_of_line@^A
Xcapitalize_word@^[c
Xclear_display@^L
Xclose_paren@)
Xcommand_completion@^\\
Xdash_to_ul_word@^[_
Xdelete_char@^D
Xdelete_region_to_killbuffer@^[k
Xdelete_word@^[d
Xdescribe_arguments@^[C
Xdescribe_bindings@^[?
Xdiscard_current_edit_line@^[^[
Xdiscard_rest_of_line@^K
Xend_of_line@^E
Xfile_completion@^C
Xfinish_editing_line@^J or ^M
Xforward_char@^F or kr
Xforward_paren@^[)
Xforward_word@^[f
Xincrement_universal_argument@^U
Xinsert_interrupt_char@^?
Xinsert_quit_char@^[Q
Xinsert_start_char@^_
Xinsert_stop_char@^^
Xinsert_suspend_char@^Z
Xlowercase_word@^[l
Xnext_line@^N or kd
Xnext_pred@^R
Xopen_paren@(
Xprevious_line@^P,^[= or ku
Xprevious_pred@^O
Xprime_from_file@^[g
Xquote_char@^V
Xrun_mesg@^[m
Xrun_ruptime@^[z
Xrun_talk@^[t
Xrun_tty_program@^[r
Xrun_write@^[w
Xset_mark@^space
Xshow_free_nodes@^[q
Xshow_mark@^X
Xshow_version@^[v
Xtoggle_add_space_mode@^[space
Xtoggle_eol_longer_mode@^[F
Xtoggle_eol_only_mode@^[E or ^[e
Xtoggle_lisp_mode@^[L
Xtoggle_nl_truncate_mode@^[N
Xtoggle_pred_mode@^[P or^[p
Xtoggle_show_eol_mode@^[S
Xtwiddle_chars@^T
Xul_to_dash_word@^[\-
Xuppercase_word@^[u
Xyank_from_kill_buffer@^Y
X.TE
X
X
X.SH ZERO FREQUENCY FILE
X
XWhen the current input has never been encountered before,
X.I "rk"
Xis forced to
Xconsult it's zero frequency data. If it exists, the file
X\fI$HOME/.rk.zero_freq\fP is read at startup. If not,
X.I "rk"
Xuses a default zero
Xfrequency table. The program "freq" will create zero frequency files for
Xyou. Simply run "freq < input_data > output_file" and the frequency's of
Xcharacters in the file input_data will be used to generate the file
Xoutput_file.
X
X
X.SH ADDING A NEW EDITING FUNCTION
X
XIf you want to add a new function to
X.I The Reactive Keyboard
Xyou need to add the function name, address and description in the
Xparse_keys.c file and the function declaration in functions.h
X
X
X.SH "FILES"
X
X.IP "freq"
XA program to generate zero frequency files.
X.IP ".rk.logfile"
XThe default file to use to prime the prediction mechanism and store all of
Xthe users input.
X.PP
X.IP ".rk.keys"
XThe default key bindings file. See Key Bindings above.
X.PP
X.IP ".rk.zero_freq"
XThe default zero frequency file. See Zero Frequency above.
X.PP
X
X.SH "AUTHORS (WHO TO BLAME)"
X
X Mark James (Key Bindings, Command Line arguments, General Maintainence)
X John Darragh (Reactive Keyboard)
X Dan Freedman (Input Line Editor)
X Doug Taylor (File Completion)
X
X
X.SH "SEE ALSO"
X
Xcsh(1),termcap(5)
X
XDarragh, J.J. (1988) ``Adaptive Predictive Text Generation And The Reactive
XKeyboard'' Research Report 88/343/05, Computer Science Department,
XUniversity of Calgary
X
X.SH "KNOWN BUGS"
X
XOn some terminals,
X.I rk
Xhas problems with displaying predictions at the right edge of the screen. If
Xthe terminal wraps some highlighted text may be left on the previous line.
X
X
XThe line editor doesn't do enough checking on the size of the input. If the
Xuser types too much input before hitting return,
X.I rk
Xwill crash.
X
XFile completion reads a character to see if it should show a different
Xcompletion. This is completely incompatible with the key bindings code.
XSince file completion only reads one character it is impossible to bind file
Xcompletion to a multi-character key like ESC-[-A. At the moment, the key
Xbindings code does not make a special case for file completion so it is
Ximpossible to bind file completion to a different key without changing the
Xsource. This will hopefully be fixed in future versions.
X
XFile completion also makes some fairly liberal assumptions about the current
Xworking directory. It is fairly simple to trick it into thinking it is in a
Xdifferent directory than it really is.
X
X.SH "WISH LIST"
X
XIt would be nice to be able to add teleportation or time travel, but I
Xunfortunately do not have time to implement these features.
X
XIt should not be too difficult to allow bindings to be changed at run time.
X
X.SH "BUG REPORTS"
X
XSend any bug reports or fixes to jamesm@cpsc.ucalgary.ca.
X
END_OF_FILE
if test 17257 -ne `wc -c <'rk.1'`; then
echo shar: \"'rk.1'\" unpacked with wrong size!
fi
# end of 'rk.1'
fi
echo shar: End of archive 2 \(of 4\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 4 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives: